package com.digital.smartgrow.service.datacenter.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.digital.smartgrow.dto.datacenter.ServiceTempPageDTO;
import com.digital.smartgrow.entity.datacenter.ServiceTemp;
import com.digital.smartgrow.dao.datacenter.ServiceTempMapper;
import com.digital.smartgrow.service.datacenter.ServiceTempService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 挂职借调 服务实现类
 * </p>
 *
 * @author xiewb
 * @since 2022-04-10
 */
@Service
public class ServiceTempServiceImpl extends ServiceImpl<ServiceTempMapper, ServiceTemp> implements ServiceTempService {

    @Override
    public Object getListByPage(ServiceTempPageDTO pageDTO) {
        Page<ServiceTemp> page = new Page<>(pageDTO.getPageNum(), pageDTO.getPageSize());
        QueryWrapper<ServiceTemp> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StringUtils.isNotBlank(pageDTO.getEmployeeId()), "employeeId", pageDTO.getEmployeeId());
        queryWrapper.like(StringUtils.isNotBlank(pageDTO.getName()), "name", pageDTO.getName());
        return this.page(page, queryWrapper);
    }

    @Override
    public Object getInfo(Integer id) {
        return this.getById(id);
    }
}
